import request from '@/utils/request'

const api_name = '/admin/post/postManager'

// 分页列表
export const GetPostPageList = (page, limit, queryDto) => {
  return request({
    url: `${api_name}/${page}/${limit}`,
    method: 'get',
    params: queryDto,
  })
}

// 添加帖子
export const SavePost = (post, userId) => {
  return request({
    url: `${api_name}/saveById`,
    method: 'post',
    data: post,
  })
}

// 修改帖子信息
export const UpdatePostById = product => {
  return request({
    url: `${api_name}/updateById`,
    method: 'put',
    data: product,
  })
}

// 根据id获取信息
export const GetPostById = id => {
  return request({
    url: `${api_name}/getById?id=` + id,
    method: 'get',
  })
}

// 根据id删除商品
export const DeletePostById = id => {
  return request({
    url: `${api_name}/deleteById?id=` + id,
    method: 'get',
  })
}

//审核
export const UpdatePostAuditStatus = (id, auditStatus) => {
  return request({
    url:
      `${api_name}/updateAuditStatus?id=` + id + '&auditStatus=' + auditStatus,
    method: 'get',
  })
}
